-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(witness): use block executor to execute block inside debug_execution_witness #10736
feat(witness): use block executor to execute block inside debug_execution_witness #10736
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be good to start with integrating the block executor into the debug_executionWitness
rpc, and then debugging. Is the assert failing due to changes in this PR or does it also occur on main? If it occurs on main, definitely submit an issue and we can focus on it there
a0d6885
to
0ef0198
Compare
a7c10ee
to
be600b0
Compare
ed3c527
to
abc3d60
Compare
@mattsse thoughts on adding executor factory to rpc? |
511b84f
to
40a9310
Compare
that makes sense, I assume this could be useful and we could extend this functionality and use this as the entrypoint to abstract execution in rpc in general |
crates/evm/src/test_utils.rs
Outdated
fn state_ref(&self) -> &State<DB> { | ||
todo!() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this now bakes in the state into the executor interface, I don't want to do this
crates/evm/src/test_utils.rs
Outdated
@@ -50,7 +51,7 @@ impl<DB> Executor<DB> for MockExecutorProvider { | |||
type Output = BlockExecutionOutput<Receipt>; | |||
type Error = BlockExecutionError; | |||
|
|||
fn execute(self, _: Self::Input<'_>) -> Result<Self::Output, Self::Error> { | |||
fn execute(&mut self, _: Self::Input<'_>) -> Result<Self::Output, Self::Error> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this necessary?
0b38792
to
f4a5f2c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would be nice with a test for DebugApi::debug_execution_witness
, however possibly running hive tests for this branch would be enough before merging? wdyt @Rjected ?
crates/rpc/rpc/src/debug.rs
Outdated
// for (address, account) in bundle_state.state { | ||
// let hashed_address = keccak256(address); | ||
// hashed_state.accounts.insert( | ||
// hashed_address, | ||
// account.account.as_ref().map(|a| a.info.clone().into()), | ||
// ); | ||
|
||
// let storage = hashed_state | ||
// .storages | ||
// .entry(hashed_address) | ||
// .or_insert_with(|| HashedStorage::new(account.status.was_destroyed())); | ||
|
||
// if let Some(account) = account.account { | ||
// if include_preimages { | ||
// state_preimages | ||
// .insert(hashed_address, alloy_rlp::encode(address).into()); | ||
// } | ||
|
||
// for (slot, value) in account.storage { | ||
// let slot = B256::from(slot); | ||
// let hashed_slot = keccak256(slot); | ||
// storage.storage.insert(hashed_slot, value); | ||
|
||
// if include_preimages { | ||
// state_preimages.insert(hashed_slot, | ||
// alloy_rlp::encode(slot).into()); } | ||
// } | ||
// } | ||
// } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably should remove this before marking pr ready for review, else mark pr as draft
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry should've changed it to draft before pushing the latest change.
There were further discussion offline regarding the latest update, I'll rework the code to reflect them.
f4a5f2c
to
c256876
Compare
Description
The code does the following:
BlockExecutorProvider
toRpcModuleBuilder
and eventually passed down toDebugApi
initializationdebug_execution_witness
API to use block_executor to execute blocks.